#include<iostream>
#include<algorithm>
using namespace std;
typedef long long LL;
const int N = 2e5 + 10;
int q[10];
int n, m;
int w[N];
struct node
{
	int l, r;
	LL mi;
	LL add;
}tree[N * 4];
void pushup(int u)
{
	//tree[u].data = tree[u << 1].data + tree[u << 1 | 1].data;
	tree[u].mi = min(tree[u << 1].mi, tree[u << 1 | 1].mi);
}
void pushdown(int u)
{
	if (tree[u].add) {
		tree[u << 1].add += tree[u].add;
		tree[u << 1 | 1].add += tree[u].add;
		tree[u << 1].mi += tree[u].add;
		tree[u << 1 | 1].mi += tree[u].add;
		tree[u].add = 0;
	}
}
void build(int u, int l, int r)
{
	if (l == r) {
		tree[u] = { l,r,w[l]};
		return;
	}
	int mid = l + r >> 1;
	tree[u] = { l,r };
	build(u << 1, l, mid);
	build(u << 1 | 1, mid + 1, r);
	pushup(u);
}
	
void change(int u, int l, int r, int v)
{
	if (tree[u].l >= l && tree[u].r <= r) {
		//tree[u].data += (tree[u].r - tree[u].l + 1) * v;
		tree[u].add += v;
		tree[u].mi += v;
		return;
	}
	pushdown(u);
	int mid = tree[u].l + tree[u].r >> 1;
    if(l<=mid)change(u << 1, l, r, v);
	if (r > mid)change(u << 1 | 1, l, r, v);
	pushup(u);
}

LL query(int u, int l, int r)
{
	if (tree[u].l >= l && tree[u].r <= r) {
		return tree[u].mi;
	}
	pushdown(u);
	int mid = tree[u].l + tree[u].r >> 1;
	LL mi = 1e15;
	if (l <= mid) mi = query(u << 1, l, r);
	if (r > mid)mi = min(mi, query(u << 1 | 1, l, r));
	return mi;
}
int main()
{
	cin >> n;
	for (int i = 1; i <= n; i++)cin >> w[i];
	build(1, 1, n);
	cin >> m;
	while (m--) {
		/*int k = 1;
		for (int i = 1; i <= 3; i++)q[i] = 0;
		char c = getchar();
		while (c != '\n') {
			q[++k] = c - '0';
		}
		int l = q[1], r = q[2];
		l++, r++;*/
		int l, r;
		cin >> l >> r;
		l++, r++;
		char c;
		c = getchar();
		if (c != '\n') {
			int x;
			cin >> x;
			if (l <= r) change(1, l, r, x);
			else {
				change(1, l, n, x), change(1, 1, r, x);
			}
		}
		else {
			if (l <= r)	cout << query(1, l, r) << endl;
			else {
				LL ans = min(query(1, 1, r), query(1, l, n));
				cout << ans << endl;
			}
		}
	}
	return 0;
}